home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / eiffel / smalleif.97 / se.t / SmallEiffel / lib_test / test_double1.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  1.1 KB  |  63 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TEST_DOUBLE1
  5.  
  6. creation {ANY}
  7.    make
  8.    
  9. feature {ANY}
  10.    
  11.    make is
  12.       local
  13.      i: INTEGER;
  14.      d, d2: DOUBLE;
  15.       do
  16.      d := 1.6;
  17.      is_true(d = d);
  18.      is_true(1.6 = d);
  19.      is_true(d >= 1.59);
  20.      is_true(d <= 1.61);
  21.      
  22.      d := 2;
  23.      is_true(d = 2.0);
  24.      
  25.      i := 2;
  26.      d := i;
  27.      is_true(d = 2);
  28.      is_true(d = 2.0);
  29.       
  30.      d := (1.51).to_string.to_double;
  31.      is_true(d < 1.511);
  32.      is_true(d > 1.509);
  33.       
  34.            d := (-1.51).to_string.to_double;
  35.      is_true(d > -1.52);
  36.      is_true(d < -1.50);
  37.      
  38.      is_true(d.abs < 1.52);
  39.      is_true(d.abs > 1.50);
  40.      is_true((-d).abs < 1.52);
  41.      is_true((-d).abs > 1.50);
  42.      
  43.      d := 4.0;
  44.      d2 := 2.0;
  45.      is_true(d.sqrt = d2);
  46.       end;
  47.    
  48.    is_true(b: BOOLEAN) is
  49.       do
  50.      cpt := cpt + 1;
  51.      if not b then
  52.         std_output.put_string("TEST_DOUBLE1: ERROR Test # ");
  53.         std_output.put_integer(cpt);
  54.         std_output.put_string("%N");
  55.      else
  56.         -- std_output.put_string("Yes%N");
  57.      end;
  58.       end;
  59.    
  60.    cpt: INTEGER;
  61.    
  62. end -- TEST_DOUBLE1
  63.